package com.cysd.ewmxns.sdw_ui.activity

import android.os.Bundle

import com.cszy.ewmxns.base.BaseVMActivity
import com.cysd.ewmxns.sdw_adapter.DetailsAdapter

import com.cysd.ewmxns.sdw_viewmodel.MainViewModel
import qrrspeeelild.rqrc0ode.andro0ild.R
import qrrspeeelild.rqrc0ode.andro0ild.databinding.ActivityDetail1Binding


class Sdw_DetailActivity1 : BaseVMActivity<MainViewModel, ActivityDetail1Binding>() {
    //传一个type过来通过instance
    var type: String? = null
    //adapter
    private var adapter: DetailsAdapter? = null
    override fun initView(savedInstanceState: Bundle?) {
        mBinding.headTitle.headCenterTitle.text = "常见问题"
        mBinding.rvDetails.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this)
        adapter = DetailsAdapter()
        mBinding.rvDetails.adapter = adapter
        type = intent.getStringExtra("type")
        when (type) {
            "1" -> {
                mBinding.ivLeft.setImageResource(R.mipmap.ic_black_ocr)
                mBinding.tvTitleDesc.text = "文字提取不精准怎么办?"
                adapter?.submitList(mViewModel.getDetailsList1())
            }
            "0" -> {
                mBinding.ivLeft.setImageResource(R.mipmap.ic_black_saoma)
                mBinding.tvTitleDesc.text = "扫码查价的信息准确吗?"
                adapter?.submitList(mViewModel.getDetailsList())
            }
        }
    }



    override fun initListener() {
       mBinding.headTitle.headBack.setOnClickListener {
           finish()
       }
    }
}